package com.easy.base.api.model.dto;

import java.io.Serializable;
import java.sql.Timestamp;

import com.easy.base.api.model.entity.UserInfoEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("SessionUser")
public class SessionUser implements Serializable {
    public SessionUser(UserInfoEntity entity) {
        this.id = entity.getId();
        this.username = entity.getUsername();
        this.valid = entity.isValid();
        this.createBy = entity.getCreateBy();
        this.createDate = entity.getCreateDate();
        this.updateBy = entity.getUpdateBy();
        this.updateDate = entity.getUpdateDate();
    }

    @ApiModelProperty("ID")
    private String id;

    @ApiModelProperty("账号")
    private String username;

    @ApiModelProperty("状态")
    private boolean valid;

    @ApiModelProperty
    private String createBy;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("创建日期")
    private Timestamp createDate;

    @ApiModelProperty
    private String updateBy;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("更新日期")
    private Timestamp updateDate;
}
